import axios from './axios.js'
function registerAdd(user,pass){
    const url = "/register"
    const data = {user,pass}
    return axios.post(url,data)
}

function LoginAdd(user,pass){
    // const  {user,pass} = payload
    console.log(user,pass);
    const url = "/login"
    return axios.post(url,{user,pass})
}

function UserList(){
    const url = "/getUsers"
    return axios.get(url)
}

function UpdateList(payload){
    const {_id, height, weight, age, sex, birthday} = payload
    const url = "/baseinfo"
    // return axios.post(url,payload)
    return axios.post(url,{_id, height, weight, age, sex, birthday})
}

function delList(id){
    const url = "/deluser"
    return axios.post(url,id)
}

function addList(payload){
    const {user,height,weight,age,sex,birthday} = payload
    const url = "/addBaseinfo"
    return axios.post(url,{user,height,weight,age,sex,birthday})
}
export default {registerAdd,LoginAdd,UserList,UpdateList,delList,addList}